function EstimateUnified(price_iv, model, par_rest, seeds, DATA, OUT, market,version) 


    close all
   
    format long g
    addpath('../helpers')
    addpath('../rcnl_demand')
    addpath('../rcnl_supply')


    disp(' ')
    disp('---------------')
    disp('LOADING DATA...')
    disp('---------------')

    tolerance = 1e-12;

    k     = floor((seeds-1)/100)+1;
    seeds = seeds - 100*(k-1);

    load(fullfile(DATA, sprintf('sim_data_sim%d_%d_%d%s.mat', k, seeds, market,version)));
    
    df_sim.cdid = df_sim.cdid_sim;
    
    suffix   = '';
    
    for i=par_rest
        suffix = [suffix, int2str(i)];
    end

    disp('[DONE]')

    % Estimate model

    disp(' ')
    disp('--------------------')
    disp('ESTIMATING DEMAND...')
    disp('--------------------')

    disp(' ')
    disp(['Model: ',model,suffix,', seed: ',int2str(seeds)])

    [dresults, dflags] = estimate_demand( ...
        coefs_sim.Pi,  ...
        coefs_sim.rho, ...
        df_sim,        ...
        dfull_sim,     ...
        price_iv,      ...
        model,         ...
        par_rest,      ...
        coefs_sim,     ...
        tolerance      ...
    );

    disp('[DONE]')

    % Save output

    mkdir(OUT);
    outfile = fullfile(OUT, sprintf('estimation_%s_%s%s_k%d_s%d_m%d%s.mat', price_iv, model, suffix, k, seeds, market, version));
      
    save(outfile,      ...
        'df_sim',      ...
        'dresults',    ...
        'dflags',      ...
        '-v7.3');


    if dflags==0
        disp('DONE: Estimation finished succesfully.')
    else
        disp('WARNING: Estimation with errors.')
    end

end
